using System;
using System.Collections.Generic;
using Eds.Model;
using Eds.Sql;
using System.Linq;
namespace NHibernate.Example.Web.Persistence
{
    public class ItemList
    {
        public IList<ReceiveMail> GetAllItems()
        {
            var s = new ReceiveMailSearch(ExampleApplication.GetCurrentSession());
            //var s = new ActiveMailSearch(ExampleApplication.GetCurrentSession());

            s.PageSize = 100;
            s.CurrentPage = 3;
            var list = s.Select();
            var list2 = list.Where(ss => ss.Reply.Count > 0);
            return list;
            //return ExampleApplication.GetCurrentSession().CreateQuery("from EdsMail").List<EdsMail>();
        }

        public void UpdateItem(EdsMail item)
        {
            //ExampleApplication.GetCurrentSession().SaveOrUpdateCopy(item);
        }

        public void DeleteItem(EdsMail item)
        {
            //ISession session = ExampleApplication.GetCurrentSession();
            //session.Delete(session.Load(typeof(EdsMail), item.MailId));
        }

        public void InsertItem(EdsMail item)
        {
            //ExampleApplication.GetCurrentSession().Save(item);
        }
    }
}